package homework1;

public class SortChar {
	public static void main(String[] args) {
		char[] ch={'a','c','u','b','e','p','f','z'};
		System.out.println("sorted before:");
		for(char x:ch)
			System.out.print(x+"\t");
		System.out.println();
		for(int i=0;i<ch.length-1;i++)
			for(int j=0;j<ch.length-1-i;j++){
				char temp;
				if(ch[j]>ch[j+1]){
					temp=ch[j];
					ch[j]=ch[j+1];
					ch[j+1]=temp;
				}
			}
		System.out.println("sorted from min to max:");
		for(char x:ch)
			System.out.print(x+"\t");
		for(int i=0;i<ch.length-1;i++)
			for(int j=0;j<ch.length-1-i;j++){
				char temp;
				if(ch[j]<ch[j+1]){
					temp=ch[j];
					ch[j]=ch[j+1];
					ch[j+1]=temp;
				}
			}
		System.out.println();
		System.out.println("sorted from max to min:");
		for(char x:ch)
			System.out.print(x+"\t");
	}

}
